@extends('public.base')
@section('body')
    <div class="layui-fluid">
        <div class="layui-card">



            <ul class="layui-tab-title">
                <li class="layui-this">购物车</li>
                <li>表单提交</li>
            </ul>
            <div class="layui-tab-content">

                <div class="layui-tab-item layui-show">
                    <table class="layui-hide" id="cart-table" lay-filter="test-table-demoEvent"></table>
                </div>
                <div class="layui-tab-item">

                    <div class="layui-card-body" style="padding: 15px;">
                        <form class="layui-form" action="" lay-filter="component-form-group">
                            <div class="layui-form-item">
                                <label class="layui-form-label">商品组合</label>
                                <div class="layui-input-block">
                                    <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>


        </div>
    </div>
    <script src="{{ADMIN_PATH}}layui/layuiadmin/layui/layui.js"></script>
    <script src="{{ADMIN_PATH}}js/admin.common.js"></script>
    <script>

        var index_url = '{{url('admin/ordersys/order/set_step2')}}';
        layui.use(['layer', 'laydate', 'table', 'element'], function () {
            var table = layui.table;
            table.render({
                elem: '#cart-table'
                , method: 'post' //接口http请求类型
                ,url: index_url
                ,cols: [[
                    {field:'goods_id', title: '产品ID', width:80}
                    ,{field:'goods_name', title: '产品名称', width:260}
                    ,{field:'goods_price', title: '产品价格', width:100}
                    ,{field:'goods_num', title: '产品数量', width:100}
                    ,{field:'goods_image', title: '产品图片', width:100, templet: layui_table_pic_1}
                ]]
            });

            //监听单元格事件
            table.on('tool(test-table-demoEvent)', function(obj){
                var data = obj.data;
                if(obj.event === 'setSign'){
                    layer.prompt({
                        formType: 2
                        ,title: '修改 ID 为 ['+ data.id +'] 的用户签名'
                        ,value: data.sign
                    }, function(value, index){
                        layer.close(index);

                        //这里一般是发送修改的Ajax请求

                        //同步更新表格和缓存对应的值
                        obj.update({
                            sign: value
                        });
                    });
                }
            });

        });
    </script>
@stop